use master;
go
--insertOrderFood
alter proc insertOrderFood
	@[id] int identity(1,1) primary key,
	@[customerid] int,
	@[orderdate] datetime,	
	@[ordertime] datetime,
	@[totalmoney] float,
	@[address] nvarchar(100),
	@[email] nvarchar(100),
	@[phone] nvarchar(100),	
	@[descr] nvarchar(500),
	@[status] bit default(0)
as
insert into [OrderFood] ([id],[customerid],[orderdate],[ordertime],[totalmoney],[address],[email],[phone],[descr],[status])
values (@[customerid],@[orderdate],@[ordertime],@[totalmoney],@[address],@[email],@[phone],@[descr],@[status])
GO
--updateStatusOrderFood
CREATE PROC updateStatusOrderFood
	@[id] int,
	@[status] bit 
AS
UPDATE [OrderFood] SET	
	[status] =@[status]
WHERE [id]=@[id]
GO
--DeleteOrderFood
CREATE PROC deleteOrderFood
	@[id] int
AS
	DELETE FROM [OrderFood] WHERE id=@BookingTableID
GO
--getAllOrderFood
Alter PROC getAllOrderFood
AS
SELECT     [OrderFood].*, [Custormer].[username]
FROM         [OrderFood] INNER JOIN
                      [Custormer] ON [OrderFood].[customerid] = [Custormer].[id]
GO
--get id customer
Alter PROC getIDCustomer
(
	@[id] int
)
AS
BEGIN
	Select	[customerid] from [OrderFood] 
	where	[id] = @[id]